<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <meta name="format-detection" content="telephone=no" />
    <title>业绩提成</title>
    <link rel="stylesheet" href="../../css/reset.css">
    <style>
        body {
            width: 100%;
            height: 100%;
            font-size: 0.28rem;
            -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
            font-family: PingFang SC;
            color: #333333;
            background-color: #f8f8f8;
        }

        button {
            outline: none;
            border: none;
        }

        .typrCommission {
            width: 100%;
            height: auto;
            margin-top: 0.3rem;
        }

        #listLi {
            width: 100%;
            height: auto;
            display: flex;
            display: -webkit-flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
        }

        #listLi li {
            width: 6.9rem;
            height: auto;
            display: flex;
            display: -webkit-flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            padding: 0.26rem 0.24rem;
            box-sizing: border-box;
            border-radius: 0.1rem;
            margin-bottom: 0.2rem;
            background-color: #fff;
        }

        #listLi li div {
            width: 100%;
            height: auto;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: space-between;
            font-size: 0.23rem;
        }

        .lifirstDiv {
            margin-bottom: 0.2rem;
        }

        .lifirstDiv p {
            display: flex;
            display: -webkit-flex;
            align-items: center;
            color: #262626;
            font-size: 0.26rem;
        }

        .lifirstDiv p img {
            width: 0.3rem;
            margin-right: 0.1rem;
        }

        .lifirstDiv button {
            width: 1.53rem;
            height: 0.52rem;
            background: rgba(255, 209, 50, 1);
            border-radius: 0.26rem;
            line-height: 0.52rem;
            text-align: center;
            color: #262626;
        }

        .lifirstDiv .openTrue {
            background: rgba(255, 209, 50, 1);
            color: #262626;
        }

        .lifirstDiv .openFalse {
            background: #EDEDED;
            color: #999999;
        }

        .secondDiv {
            color: #999999;
        }

        .secondDiv .coinNum {
            color: #F57311;
            margin-left: 0.1rem;
        }

        .secondDiv .litNum {
            color: #262626;
            margin-left: 0.1rem;
        }

        .stutImg {
            width: 100%;
            height: auto;
            color: #ED3333;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: flex-end;
            font-size: 0.22rem;
            margin-top: 0.1rem;
        }

        .stutImg img {
            width: 0.22rem;
            margin-right: 0.1rem;
        }

        .tipsText {
            width: 100%;
            height: auto;
        }

        .ulLiText {
            width: 100%;
            height: auto;
            display: flex;
            display: -webkit-flex;
            flex-direction: column;
            align-items: flex-start;
            justify-content: flex-start;
            padding-left: 0.28rem;
            box-sizing: border-box;
        }

        .ulLiText li {
            width: 100%;
            height: auto;
            font-size: 0.24rem;
            font-family: PingFang SC;
            font-weight: 500;
            color: rgba(153, 153, 153, 1);
            line-height: 0.36rem;
        }

        .seeId {
            width: 6.9rem;
            height: 0.88rem;
            background: #FFD132;
            border-radius: 0.08rem;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: center;
            margin-left: calc((100% - 6.9rem) / 2);
            font-size: 0.3rem;
            color: #262626;
            margin-top: 0.4rem;
            margin-bottom: 0.16rem;
        }
    </style>
</head>

<body>
    <div class="typrCommission">
        <ul id="listLi">
            <!-- <li>
                <div class="lifirstDiv">
                    <p>
                        <img src="../../image/filnexw.png"> <span>IPFS提成账户</span>
                    </p>
                    <button>
                        提现
                    </button>
                </div>
                <div class="secondDiv">
                    <p>
                        余额(CNY) <span class="coinNum">4432541.21 </span>
                    </p>
                    <p>
                        本月剩余提现 <span class="litNum">1次</span>
                    </p>
                </div>
                <p class="stutImg">
                    <img src="../../image/xiaobiaoshix.png"> <span>有正在审核中的申请</span>
                </p>
            </li> -->
        </ul>
        <button class="seeId">
            查看任务ID
        </button>
    </div>
    <div class="tipsText">
        <ul class="ulLiText">
            <li>注：</li>
            <li>1.每个账户每月仅可提现1次</li>
            <li>2.审核中的申请消耗当月次数，若提现失败，当月次数恢复</li>
            <li>3.每个账户仅支持有1笔审核状态申请</li>
            <li class="showPresonTips" style="display: none;">4.每月提现限额为100,000 CNY</li>
            <!-- <li style="color: #ED3333;">4.提现审核通过，可在【记录】中查看任务ID</li> -->
        </ul>
    </div>
</body>
<script src="../../script/autosize.js"></script>
<script src="../../script/jquery_three_two_one.js"></script>
<script src="../../script/fastclick.js"></script>
<script src="../../script/dotmin.js"></script>
<script src="../../script/app.js"></script>
<script>
    apiready = function () {
        var app = new APP();
        //请求页面参数
        function getPage(params) {
            var account = app.getAccount();
            app.ajaxPro({
                url: "ipfs-withdraw/performance-commission-account",
                values: {
                    token: account.token
                },
                openFlower: true
            }, function (ret) {
                if (ret.code == 200) {
                    ret.data.map(function (item) {
                        if (item.is_assign_account.type && item.is_assign_account.type == 1) {
                            $(".showPresonTips").show();
                        }
                        item.accountDis = item.is_assign_account == "" ? false : true;
                        item.buttonStatus = true;
                        if (item.state == 2 || item.remain_time == 0 || item.accountDis == false || item.state == 4) {
                            item.buttonStatus = false;
                        }
                        item.is_assign_account = JSON.stringify(item.is_assign_account);
                        item.name = item.account_name.split("_")[0] + "提成账户";
                        item.assets = app.sliceNum(item.assets, 2);
                        if (item.account_name.split("_")[0] == "BTC") {
                            item.imgIcon = "../../image/btcicnx.png";
                        } else {
                            item.imgIcon = "../../image/filnexw.png";
                        }
                    })
                    var temp = doT.template($("#tranferListData").text());
                    $("#listLi").html(temp(ret.data));
                } else {
                    app.toast(ret.meaasge);
                }
            })
        }
        getPage();
        function toWapTaskList(){
            // api.clearCache();
            //http://ihulatu.t1.anmaicloud.com/
            var wapUrl = app.isEnvironment === 0 ? 'http://wapfront.t1.anmaicloud.com/html/#/' : 'https://wap.renrenmine.com/html/#/';
            var winUrl = wapUrl+'taxReward_list';
            app.openWin({
                name: "step_list",
                url: app.hd + "common/headerwin.html",
                pageParam: {
                    subpage: winUrl,
                    name: "browser_header_win",
                    type: "remote",
                    isremote: "true",
                    title: "查看任务",
                    loading : true,
                }
            });
        }
        $("#listLi").on("click", "li button", function () {
            if ($(this).attr("data-accountDis") == "false") {
                var param = {
                    dtype: "dialog90",
                    data: {
                        tips: '请联系管理员配置业绩提成账户'
                    }
                };
                //提示公共弹窗
                app.dialog(param);
                return
            }
            if ($(this).attr("data-status") == "false") {
                return
            }
            var iscanEdit = true;
            var objAccount = JSON.parse($(this).attr("data-account"));
            if (objAccount.type) {
                iscanEdit = false;
            }
            var pageValue = {
                name: "coin_getout",
                subpage: "salescommission/coin_getout",
                title: $(this).attr("data-name"),
                allowEdit: iscanEdit,
                param: {
                    pageName: "coin_getout",
                    allowEdit: iscanEdit,
                    coinType: $(this).attr("data-coin"),
                    coinNum: $(this).attr("data-coinNum"),
                    assstAccout: $(this).attr("data-account"),
                    phoneNum: $(this).attr("data-phone")
                }
            }
            app.setNavBarAttr(pageValue);
        });
        $(".seeId").click(function () {
            toWapTaskList();
            return;
            var pageValue = {
                name: "entry_record",
                subpage: "salescommission/entry_record",
                title: "记录",
                param: {
                    pageName: "entry_record"
                }
            };
            app.setNavBarAttr(pageValue);
        });
        var curWinName = null;// h5当前页名称
        app.listen('task_goPage',function (ret) {
            //监听wap端给的路由跳转
            app.log('task_goPage+++++++++++++++++++++++++',ret);
            var value = ret.value;
            var path = value.path;
            var name = value.name;
            app.openWin({
                name: name,
                url: app.hd + "common/headerwin.html",
                syncCooki :false,
                pageParam: {
                    subpage: path,
                    name: "taskDetail_headerwin"+ Math.floor(Math.random()*(1-10000) + 10000),
                    type: "remote",
                    useWKWebView : true,
                    // isremote: true,
                    // needReload : true,  //防止新开h5 wap页面有缓存，会无法运行
                    title: "查看任务",
                    loading : true,
                }
            });
        });
        app.listen("closeToWin",function () {
            //监听wap给的关闭当前页，打开新的页面
            var value = ret.value;
            var path = value.path;
            curWinName = "browser_header_win" + Math.floor(Math.random()*(1-10000) + 10000);//注意防止name重复，不然打不开
            app.closeW(curWinName);
            app.openWin({
                name: curWinName,
                url: app.hd + "common/headerwin.html",
                syncCooki :false,
                pageParam: {
                    subpage: path,
                    name: "taskDetail_headerwin"+ Math.floor(Math.random()*(1-10000) + 10000),
                    type: "remote",
                    useWKWebView : true,
                    isremote: true,
                    needReload : true,  //防止新开h5 wap页面有缓存，会无法运行
                    title: "查看任务"
                }
            });
        });
        app.headerMap(function (ret) {
            toWapTaskList();
            // var goCerfition = {
            //     page: "common/headerwin",
            //     name: ret.name + "_headerwin",
            //     param: {
            //         subpage: ret.subpage,
            //         name: ret.name,
            //         title: ret.title
            //     }
            // };
            // var recoinNumber = JSON.stringify(goCerfition);
            // app.goPushPage(recoinNumber);
        });
        app.listen("getoutYeji", function () {
            $("#listLi").empty();
            getPage();
        })
        app.downRefresh(function () {
            $("#listLi").empty();
            getPage();
        })
    }
</script>
<script type="text/html" id="tranferListData">
    {{~it:it:index}}
    <li>
        <div class="lifirstDiv">
            <p>
                <img src={{=it.imgIcon}}> <span>{{=it.name}} </span>
            </p>
            <button data-status={{=it.buttonStatus}} data-name={{=it.name}} data-coin={{=it.account_name}} data-coinNum={{=it.assets}} class='{{=it.buttonStatus== true? "openTrue":"openFalse"}}' data-account='{{=it.is_assign_account}}' data-accountDis={{=it.accountDis}} data-phone="{{=it.phone}}">
                提现
            </button>
        </div>
        <div class="secondDiv">
            <p>
                余额(CNY) <span class="coinNum">{{=it.assets}}</span>
            </p>
            <p>
                本月剩余提现 <span class="litNum">{{=it.remain_time}}次</span>
            </p>
        </div>
        {{?(it.state!=2 && it.state!=3 && it.state!=0) || (it.next_month==1)}}
            <p class="stutImg">
                <img src="../../image/xiaobiaoshix.png"> <span>有正在审核中的申请</span>
            </p>
        {{?}}
    </li>
    {{~}}
</script>

</html>